<?php
/**
 * Created by 1971599474@qq.com
 * User: zhixuan
 * Date: 2019/12/21
 * Time: 8:48
 */

namespace app\gii\controller;


use app\common\controller\BaseController;
use app\common\utils\JsonService;

class Login extends BaseController
{

    public function index(){


        return $this->fetch('index/login');
    }

    /*
     * 验证gii_token
     * */
    public function verify(){
        $token = $this->request->post('token');
        $ip = $this->request->ip();
        $ips = app()->config->get('app.gii.allowedIPs');
        if($token == app()->config->get('app.gii.token') && in_array($ip,$ips)){
            session('gii_token',app()->config->get('app.gii.token'));
            return JsonService::success('验证成功');
        }
        return JsonService::error('token验证不能正确');
    }
}